<template name="gateway">
	<view>
		<scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''">
			<cu-custom bgColor="bg-gradual-pink" :isBack="true">
				<block slot="content">设备分析</block>
			</cu-custom>
			<view class="disflexconent">
				<view class="title">设备安装数据统计</view>
				<view class="span">
					<analysisdrawer ref="drawershow" :type="typelei" @testShow="getlist"></analysisdrawer>
				</view>
			</view>
			<view class="labelnum padding">合计：安装场所:0;安装场所:0;安装场所:0;安装场所:0;安装场所:0;安装场所:0;</view>
			<view class="h-table">
				<view class="h-tr h-tr-3 h-thead">
					<view class="h-td">场所类型</view>
					<view class="h-td">排查场所数</view>
					<view class="h-td">整改场所数</view>
					<view class="h-td">场所整改率</view>
					<view class="h-td">隐患数</view>
					<view class="h-td">隐患整改数</view>
					<view class="h-td">隐患整改率</view>
				</view>
				<view class="h-tr h-tr-3" v-for="item in 3" @click="rowClick">
					<view class="h-td">11</view>
					<view class="h-td">22</view>
					<view class="h-td">33</view>
					<view class="h-td">44</view>
					<view class="h-td">55</view>
					<view class="h-td">6654</view>
					<view class="h-td">12345</view>
				</view>
			</view>
			<!-- 场所管理 -->
			<management ref="manage" @clickBrotherBtn="clickBrotherBtn"></management>
		</scroll-view>

	</view>
</template>

<script>
	import searchinput from '../component/searchinput.vue'
	import analysisdrawer from '../component/analysisdrawer.vue'
	import management from '../component/management.vue'
	
	export default {

		name: 'gateway',
		props: {
			cur: String,
		},
		watch: {

		},
		data() {
			return {
				modalName: null,
				formData: {
					checkStartTime: '',
				},
				typelei:5
			}
		},
		methods: {
			//第二层筛选
			clickBrotherBtn(num){
				console.log(num)
				this.typelei = num
				this.$refs.drawershow.showDrawer()
			},
			rowClick(){
				this.$refs.manage.showDrawer()
			},
			showDrawer() {
				this.$refs["showLeft"].open();
				//行业类别
				// server.categoryList().then(res => {
				// 	this.$nextTick(function() {
				// 		console.log(res)
				// 		this.categoryList = res.data.result
				// 	});

				// })
			},
			//获取列表
			getlist(rel) {
				console.log(rel)
				var formData = []
				if (rel) {
					formData = rel
				} else {
					formData = this.formData
				}
				this.$refs.drawershow.closeDrawer()
				console.log(formData)
				//显示加载框
				uni.showLoading({
					title: '加载中'
				});
				this.$http.get("/place/danger/page", {
					params: formData
				}).then(res => {
					console.log(res)
					if (res.data.code == 200) {
						this.formDatalist = res.data.result.records
						// this.$tip.success('获取列表成功!')
						uni.hideLoading();
					} else {
						this.$tip.success('获取列表失败!')
						uni.hideToast();
					}
			
			
				})
			},
		},
		components: {
			searchinput,
			analysisdrawer,
			management
		}
	}
</script>

<style scoped lang="scss">
	.disflexconent {
		display: flex;
		justify-content: space-between;
		padding: 15px 10px;
		background-color: white;
		font-size: 16px;
		.title{
			font-weight: bold;
		}
		// span {
		// 	width: 20%;
		// 	display: flex;
		// 	align-items: center;
		// 	justify-content: center;
		// 	background: white;
		// }
	}
	.labelnum{
		font-size: 18px;
	}
	// 时间
	.uni-btn-v {
		display: flex;
		margin-top: 20px;
		position: fixed;
		bottom: 0;
		width: 100%;

		uni-button {
			width: 100%;
			border-radius: 30px;
			margin: 10px;
		}

		uni-button:after {
			border: unset;
		}
	}


</style>
